package com.gome.han.cloud.dashboard;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;

/**
* @author hanpeng
* @version 创建时间：2020年8月8日 下午12:57:45
* @ClassName 类名称
* @Description 类描述
* 还依赖于注册中心 
* 以及spring-cloud-provider-hystrix 
* 这个只是对单个服务的监控
*/
//@EnableEurekaClient
// @RibbonClient(name="ribbon名称",configuration= {}) 配置类 里面可以有IRule 的实现类
@SpringBootApplication
@EnableHystrixDashboard
public class Application {
	public static void main(String[] args) {
		SpringApplication.run(Application.class);
	}
	@Bean
	public ServletRegistrationBean<HystrixMetricsStreamServlet> getServletRegister() {
		ServletRegistrationBean<HystrixMetricsStreamServlet> servletRegistrationBean = new ServletRegistrationBean<HystrixMetricsStreamServlet>(new HystrixMetricsStreamServlet());
		servletRegistrationBean.addUrlMappings("/actuator/hystrix.stream");
		//页面上有提示
		return servletRegistrationBean;
		
	}
}
